<?php


namespace app\rest\controller;


use think\Controller;
use think\Db;

class Test extends Controller
{
    public function  index()
    {
     $row = Db::name('user')
            ->where('id','>','20')
            ->select();

      $row=  Db::table('hc_user')
          ->where('id',20)
          ->find();

        $row=Db::table('hc_user')
            ->where('status',2)
            ->select();
        $row=Db::name('user')
            ->where('id',12)
            ->find();
        $row= Db::table('hc_user')->where('id',2)->value('name');
        $row=Db::table('hc_user')->where('sex',1)->column('name');
        $row=Db::table('hc_user')->where('sex',1)->column('id','name');
        $row=Db::table('hc_user')->where('sex',1)->column('id,name');

        $data=[
            ['name'=>'liuliuliujj0','sex'=>'1','age'=>'26','pass'=>'123456','province'=>'安徽'],
            ['name'=>'liuliuliujj1','sex'=>'1','age'=>'26','pass'=>'123456','province'=>'安徽'],
            ['name'=>'liuliuliujj2','sex'=>'1','age'=>'26','pass'=>'123456','province'=>'安徽'],

        ];
//        $row=Db::name('user')->insert($data);
//        $id = Db::name('user')->getLastInsID();
//        $row=Db::name('user')->insertGetId($data);
//        $row= Db::name('user')->insertAll($data);

//        $row=Db::name('user')->update(['name' => 'thinkphp123','id'=>2]);
//        $row=Db::table('hc_user')->where('id', 2)->setDec('age','10');
//        $row=db('user')->delete([51,52,53]);
        $row=Db::table('hc_user')
            ->where('name', 'not null')
            ->select();

//        $row=Db::getTableInfo('hc_user');
        dump($row);


    }
}